/*
* Copyright 2015 2dfire.com All right reserved. This software is the
* confidential and proprietary information of 2dfire.com ("Confidential
* Information"). You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with 2dfire.com.
*/
package com.dfire.mtm.executor;

import com.dfire.mtm.taskNode.TaskData;
import com.dfire.mtm.taskNode.TaskNode;

/**
 * @author guipi
 * @description
 * @date 2018/10/23
 * ----------重大变更记录------------
 */
public interface MtmRunnable extends Runnable {

    TaskNode getTaskNode();

    void setTaskNode(TaskNode taskNode);

    /**
     * 获取最近一次的任务数据
     * @param <T>
     * @return
     */
    <T> TaskData<T> getData();

    /**
     * 根据任务来获取数据
     * @param task
     * @param <T>
     * @return
     */
    <T> T getData(String task);

    /**
     * 完成任务后数据发送到下游
     * @param data
     * @param <T>
     * @return
     */
    <T> boolean pushData(String task, T data);

    /**
     * 完成任务后数据发送到指定下游
     * @param data
     * @param <T>
     * @return
     */
    <T> boolean pushData(String task, String nodeName,T data);

    /**
     * 是否准备好
     * @return
     */
    boolean isReady();

    void setReady(boolean ready);
}
